﻿using Caliburn.Micro;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common;

namespace LearnEnglishWords.UI.ViewModels
{
    public class RussianCardViewModel : BaseViewModel
    {
        private String _russianWord;
        public String RussianWord
        {
            get { return _russianWord; }
            set { _russianWord = value; NotifyOfPropertyChange(); }
        }

        protected override void OnActivate()
        {
            base.OnActivate();

            _circlesModel.WordChanged += _circlesModel_WordChanged;
            Init();
        }

        protected override void OnDeactivate(bool close)
        {
            _circlesModel.WordChanged -= _circlesModel_WordChanged;

            base.OnDeactivate(close);
        }

        private void _circlesModel_WordChanged()
        {
            Init();
        }

        public void Init()
        {
            RussianWord = _circlesModel.CurrentWord == null ? "" : _circlesModel.CurrentWord.RussianWord;
        }
    }
}
